Sipser CH2 Exercises' Answer 2.1-2.17
2.2
- a.Construct PDA to recognize A and B,for
,use pumping lemma, easily know is not CFL. - b.
,if CFL is closed under complementation, then it's closed under intersection .Contradiction!
2.4
- a.
- b.
- c.
- d.
- e.
- f.
2.5
考察CFG转化PDA,具体流程见教材,过于繁琐此处略
2.6
- a.
- b
- c.
- d.
2.9
- 考虑
,会有两个最左推导,故而歧义
2.10
This language is recognized by a non-deterministic pushdown automaton
(NPDA) that initially guesses which of the two conditions to verify:
that the number of '
2.11,2.12
均为CFG转化PDA,详见教材
2.13
假设
2.14
2.15
考虑
2.16
由 CFG 生成,即 由 CFG 生成,即 - Union:添加
- Concatenation:添加
- Star:添加
2.17
- 利用归纳法
- 基本情况:
,可以构造CFG - 归纳假设:正则语言是由基本情况的正则运算组合构成的,而CFL在正则运算下封闭,故正则语言都是CFL
- 基本情况:
- 示例:将 RE
(a+b)*c
转换为 CFG: : :